package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ManBean;
import com.project.mapper.IManMapper;
import com.project.service.IManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@Transactional
public class ManServiceImpl implements IManService {
    @Autowired
    private IManMapper mapper ;


    @Override
    public void add(ManBean man) {
        mapper.add(man);
    }

    @Override
    public PageInfo<ManBean> findAll(int pageNo) {
        PageHelper.startPage(pageNo,3);
        PageInfo<ManBean>pageInfo=PageInfo.of(mapper.findAll());
        return pageInfo;
    }

    @Override
    public void del(int id) {
        mapper.del(id);
    }

    @Override
    public void update(int id, LocalDate birthday) {
        mapper.update(id,birthday);
    }

    @Override
    public ManBean findById(int id) {
       return mapper.findById(id);
    }
}
